<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <style>
    * {
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }
    body {
      width: 100vw;
      height: 100vh;
      display: flex;
      overflow: hidden;
    }

    .left,.right {
      background-size: cover;
      background-position: center;
      background-repeat: no-repeat;
      height: 100%;
      width: 50%;
      position: relative;
      transition: all 0.8s ease-in-out;
    }

    .left::before,.right::before {
      content: '';
      position: absolute;
      width: 100%;
      height: 100%;
      background-color: #7f7ceb;
      opacity: 0.4;
    }

    .right::before {
      background-color: #2a292a;
    }

    .left {
      background-image: url(./image.png);
    }

    .right {
      background-image: url(./image2.png);
    }

    .content {
      color: #fff;
      position: absolute;
      top: 30%;
      left: 50%;
      transform: translateX(-50%);
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
      flex-shrink: 1;
      width: 300px;
    }

    .btn {
      width: 200px;
      height: 60px;
      line-height: 60px;
      text-align: center;
      text-transform: uppercase;
      font-weight: 700;
      border: 3px solid #fff;
      margin-top: 20px;
      cursor: pointer;
    }

    h1 {
      font-size: 30px;
    }

    .left .btn:hover {
      border-color: #5754ec;
      background-color: #5754ec;
    }

    .right .btn:hover {
      border-color: #1c7a1c;
      background-color: #1c7a1c;
    }
  </style>
</head>
<body>

  <div class="left">
    <div class="content">
      <h1>Playstation 5</h1>
      <div class="btn">buy now</div>
    </div>
  </div>
  <div class="right">
    <div class="content">
      <h1>XBox Series X</h1>
      <div class="btn">buy now</div>
    </div>
  </div>



  

  <script>
    const left = document.querySelector('.left')
    const right = document.querySelector('.right')
    
    left.addEventListener('mouseenter',() => {
      left.style.width = "80%"
      right.style.width = "20%"
    })

    right.addEventListener('mouseenter',() => {
      right.style.width = "80%"
      left.style.width = "20%"
    })

  </script>
  
</body>
</html>